﻿using Abp.Runtime.Caching;
using Mt.Site.Core.Organizations.UserCache.Models;

namespace Mt.Site.Core.WorkFlows.Design.Cache
{
    public static class WorkFlowCacheManagerExtensions
    {
        public static ITypedCache<string, WorkFlowCacheItem> GetWorkFlowCache(this ICacheManager cacheManager)
        {
            return cacheManager.GetCache<string, WorkFlowCacheItem>(WorkFlowCacheItem.CacheStoreName);
        }

        public static UserFilter ToUserFilter(this IWorkFlowNodeCacheItem workFlowNodeCache)
        {
            return new UserFilter
            {
                BeforeSelectFilter = workFlowNodeCache.BeforeSelectFilter,
                BeforeSelectMoreFilter = workFlowNodeCache.BeforeSelectMoreFilter,
                SelectedFilter = workFlowNodeCache.SelectedFilter,
                SelectedMoreFilter = workFlowNodeCache.SelectedMoreFilter,

            };
        }
    }
    
}
